package com.example.zhaoping.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.zhaoping.domain.Jobs;
import com.example.zhaoping.domain.ResponseResult;
import com.example.zhaoping.service.IJobsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 正在招聘的岗位表 前端控制器
 * </p>
 *
 * @author czx
 * @since 2024-12-25
 */
@RestController
@Api(tags = "岗位管理")
@RequestMapping("/jobs")
public class JobsController {
    @Autowired
    private IJobsService jobsService;
//    @ApiOperation(value = "岗位列表")
//    @GetMapping("/list")
//    public ResponseResult list() {
//        return ResponseResult.okResult(jobsService.list());
//    }

    @ApiOperation("分页查询岗位列表")
    @GetMapping("/list")
    public ResponseResult jobsList(Integer pageNum, Integer pageSize, String title) {
        return jobsService.jobsList(pageNum, pageSize, title);
    }
    @ApiOperation("新增岗位")
    @PostMapping("/addjobs")
    public ResponseResult addJobs(@RequestBody Jobs Jobs) {
        jobsService.save(Jobs);
        return ResponseResult.okResult();
    }

    @ApiOperation("删除岗位")
    @DeleteMapping("/deletejobs/{id}")
    public ResponseResult deleteJobs(@PathVariable Long id) {
        jobsService.removeById(id);
        return ResponseResult.okResult();
    }
    @ApiOperation("修改岗位")
    @PutMapping("/updatejobs")
    public ResponseResult updateJobs(@RequestBody Jobs Jobs) {
        jobsService.updateById(Jobs);
        return ResponseResult.okResult();
    }
    @ApiOperation("根据公司id查询岗位并且分页")
    @GetMapping("/getjobs/{id}")
    public ResponseResult getJobs(@PathVariable Long id,Integer pageNum, Integer pageSize) {
       return jobsService.getJobsById(id,pageNum,pageSize);



    }



}
